import type { RouteRecordRaw } from 'vue-router';

/** 默认布局 */
const Layout = () => import('@/layout/index.vue');

/** 前台布局 */
const frontLayout = () => import('@/layout/frontLayout.vue');

/** 系统路由 */
export const systemRoutes: RouteRecordRaw[] = [
	{
		path: '/',
		redirect: '/front/index'
	},
	{
		path: '/login',
		name: 'Login',
		component: () => import('@/views/login/index.vue'),
		meta: { hidden: true }
	},
	{
		path: '/admin',
		name: 'Dashboard',
		component: Layout,
		redirect: '/dashboard/workplace',
		meta: { title: '仪表盘', icon: 'dashboard', hidden: false },
		children: [
			{
				path: '/dashboard/workplace',
				name: 'Workplace',
				component: () => import('@/views/dashboard/workplace/index.vue'),
				meta: { title: '工作台', icon: 'desktop', hidden: false, affix: true }
			},
			{
				path: '/dashboard/analysis',
				name: 'Analysis',
				component: () => import('@/views/dashboard/analysis/index.vue'),
				meta: { title: '分析页', icon: 'insert-chart', hidden: false }
			}
		]
	},
	{
		path: '/social/callback',
		component: () => import('@/views/login/social/index.vue'),
		meta: { hidden: true }
	},
	{
		path: '/pwdExpired',
		component: () => import('@/views/login/pwdExpired/index.vue'),
		meta: { hidden: true }
	},
	{
		path: '/user',
		name: 'User',
		component: Layout,
		meta: { hidden: true },
		children: [
			{
				path: '/user/profile',
				name: 'UserProfile',
				component: () => import('@/views/user/profile/index.vue'),
				meta: { title: '个人中心', showInTabs: false }
			},
			{
				path: '/user/message',
				name: 'UserMessage',
				component: () => import('@/views/user/message/index.vue'),
				meta: { title: '消息中心', showInTabs: false }
			},
			{
				path: '/user/notice',
				name: 'UserNotice',
				component: () => import('@/views/user/message/components/view/index.vue'),
				meta: { title: '查看公告' }
			}
		]
	},
	{
		path: '/front',
		name: 'Front',
		component: frontLayout,
		redirect: '/front/index',
		meta: { hidden: true },
		children: [
			{
				path: 'index',
				name: 'FrontIndex',
				component: () => import('@/views/front/index/index.vue'),
				meta: { title: '首页', showInTabs: false, isFooter: true }
			},
			{
				path: 'service',
				name: 'FrontService',
				component: () => import('@/views/front/service/index.vue'),
				meta: { title: '服务中心', showInTabs: false, isFooter: true }
			},
			{
				path: 'application',
				name: 'FrontApplication',
				component: () => import('@/views/front/application/index.vue'),
				meta: { title: '应用中心', showInTabs: false, isFooter: true }
			},
			{
				path: 'portal',
				name: 'FrontPortal',
				component: () => import('@/views/front/portal/index.vue'),
				meta: { title: '统一门户', showInTabs: false, isFooter: false }
			},
			{
				path: 'agenda',
				name: 'FrontAgenda',
				redirect: '/front/agenda/dispose',
				component: () => import('@/views/front/agenda/index.vue'),
				meta: { title: '日程管理', showInTabs: false },
				children: [
					{
						path: 'dispose',
						name: 'FrontAgendaDispose',
						redirect: '/front/agenda/dispose/todo',
						component: () => import('@/views/front/agenda/dispose/index.vue'),
						meta: { title: '处理类', showInTabs: false },
						children: [
							{
								path: 'todo',
								name: 'FrontAgendaDisposeTodo',
								component: () => import('@/views/front/agenda/dispose/todo.vue'),
								meta: { title: '未处理', showInTabs: false }
							},
							{
								path: 'wait',
								name: 'FrontAgendaDisposeWait',
								component: () => import('@/views/front/agenda/dispose/wait.vue'),
								meta: { title: '稍后处理', showInTabs: false }
							},
							{
								path: 'done',
								name: 'FrontAgendaDisposeDone',
								component: () => import('@/views/front/agenda/dispose/done.vue'),
								meta: { title: '已处理', showInTabs: false }
							}
						]
					},
					{
						path: 'review',
						name: 'FrontAgendaReview',
						component: () => import('@/views/front/agenda/review/index.vue'),
						meta: { title: '阅办类', showInTabs: false },
						children: [
							{
								path: 'unread',
								name: 'FrontAgendaReviewUnread',
								component: () => import('@/views/front/agenda/review/unread.vue'),
								meta: { title: '未处理', showInTabs: false }
							},
							{
								path: 'wait',
								name: 'FrontAgendaReviewWait',
								component: () => import('@/views/front/agenda/review/wait.vue'),
								meta: { title: '稍后处理', showInTabs: false }
							},
							{
								path: 'readed',
								name: 'FrontAgendaReviewReaded',
								component: () => import('@/views/front/agenda/review/readed.vue'),
								meta: { title: '已处理', showInTabs: false }
							}
						]
					},
					{
						path: 'reading',
						name: 'FrontAgendaReading',
						component: () => import('@/views/front/agenda/reading/index.vue'),
						meta: { title: '阅读类', showInTabs: false },
						children: [
							{
								path: 'unread',
								name: 'FrontAgendaReadingUnread',
								component: () => import('@/views/front/agenda/reading/unread.vue'),
								meta: { title: '未处理', showInTabs: false }
							},
							{
								path: 'wait',
								name: 'FrontAgendaReadingWait',
								component: () => import('@/views/front/agenda/reading/wait.vue'),
								meta: { title: '稍后处理', showInTabs: false }
							},
							{
								path: 'readed',
								name: 'FrontAgendaReadingReaded',
								component: () => import('@/views/front/agenda/reading/readed.vue'),
								meta: { title: '已处理', showInTabs: false }
							}
						]
					},
					{
						path: 'system',
						name: 'FrontAgendaSystem',
						component: () => import('@/views/front/agenda/system/index.vue'),
						meta: { title: '系统通知类', showInTabs: false },
						children: [
							{
								path: 'unread',
								name: 'FrontAgendaSystemUnread',
								component: () => import('@/views/front/agenda/system/unread.vue'),
								meta: { title: '未处理', showInTabs: false }
							},
							{
								path: 'readed',
								name: 'FrontAgendaSystemReaded',
								component: () => import('@/views/front/agenda/system/readed.vue'),
								meta: { title: '已处理', showInTabs: false }
							}
						]
					}
				]
			}
		]
	},
	{
		path: '/about',
		name: 'About',
		component: Layout,
		meta: { title: '关于项目', icon: 'apps', hidden: false, sort: 999 },
		redirect: '/about/document/api',
		children: [
			{
				path: '/about/document/api',
				component: () => import('@/views/about/document/api/index.vue'),
				meta: { title: '接口文档', icon: 'swagger', hidden: false, keepAlive: true }
			},
			{
				path: '/about/document/changelog',
				component: () => import('@/views/about/document/changelog/index.vue'),
				meta: { title: '更新日志', icon: 'continew', hidden: false, keepAlive: true }
			},
			{
				path: 'https://arco.design/vue/component/button',
				meta: { title: 'Arco Design文档', icon: 'arco', hidden: false }
			},
			{
				path: '/about/source',
				name: 'AboutSource',
				meta: { title: '开源地址', icon: 'github', hidden: false },
				children: [
					{
						path: 'https://gitee.com/continew/continew-admin',
						meta: { title: 'Gitee', icon: 'gitee', hidden: false }
					},
					{
						path: 'https://gitcode.com/continew/continew-admin',
						meta: { title: 'GitCode', icon: 'gitcode', hidden: false }
					},
					{
						path: 'https://github.com/continew-org/continew-admin',
						meta: { title: 'GitHub', icon: 'github', hidden: false }
					}
				]
			}
		]
	}
];

// 固定路由（默认路由）
export const constantRoutes: RouteRecordRaw[] = [
	{
		path: '/redirect',
		component: Layout,
		meta: { hidden: true },
		children: [
			{
				path: '/redirect/:path(.*)',
				component: () => import('@/views/default/redirect/index.vue')
			}
		]
	},
	{
		path: '/:pathMatch(.*)*',
		component: () => import('@/views/default/error/404.vue'),
		meta: { hidden: true }
	},
	{
		path: '/403',
		component: () => import('@/views/default/error/403.vue'),
		meta: { hidden: true }
	}
];
